import os
import traceback
import sys
import time
import json
import importlib
from random import randint
import traceback
import sys
import uuid
import time
import secrets
import requests

pythonVersion = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"

class SumaException:
    def __init__(self):
        self.creater_name = "SumaRoder"
        self.creater_qq = "1493813167"
        self.function_name = "SumaException"
        self.function_desc = "This is an exception trace id manager"
        self.function_version = "2.4.1 b2"
        self.trace_list = []
    def traceIdLogIn(self,trace_class,trace_id):
        try:
            trace = {
                "trace_id": trace_id,
                "trace_class": trace_class,
                "trace_time": time.time()
            }
            self.trace_list.append(trace)
            return "Successful"
        except:
            return "Failed"
    def traceIdQuery(self,trace_id):
        try:
            for i in self.trace_list:
                if i["trace_id"] == trace_id:
                    return i
            return  "Failed"
        except:
            return "Failed"
SumaException = SumaException()

class SumaConsole:
    def __init__(self):
        self.creater_name = "SumaRoder"
        self.creater_qq = "1493813167"
        self.function_name = "SumaConsole"
        self.function_desc = "This is a print style function."
        self.function_version = "2.1.4 a3"
    def yellow(self,text):
        text = "\033[0;33;m" + str(text) + "\033[0m"
        return text
    def red(self,text):
        text = "\033[0;31;m" + str(text) + "\033[0m"
        return text
    def black(self,text):
        text = "\033[0;30;m" + str(text) + "\033[0m"
        return text
    def green(self,text):
        text = "\033[0;32;m" + str(text) + "\033[0m"
        return text
    def ryan(self,text):
        text = "\033[0;36;m" + str(text) + "\033[0m"
        return text
    def blue(self,text):
        text = "\033[0;34;m" + str(text) + "\033[0m"
        return text
    def clearLastLine(self):
        CURSOR_UP_ONE = '\x1b[1A'
        ERASE_LINE = '\x1b[2K'
        sys.stdout.write(CURSOR_UP_ONE)
        sys.stdout.write(ERASE_LINE)
SumaConsole = SumaConsole()


